
#include <mockcpp/mockcpp.hpp>
#include <testngpp/testngpp.hpp>
#include <stdexcept>

#include <sstream>
#include <Length.h>
#include <Volume.h>

USING_MOCKCPP_NS
USING_TESTNGPP_NS

FIXTURE(Length)
{
    TEST(should be able check equation of 1 mile and 1760 yards)
    {
        ASSERT_EQ(Length(1, MILE), Length(1760, YARD));
    }

    TEST(should be able to check equation of 1 yard and 3 feet)
    {
        ASSERT_EQ(Length(1, YARD), Length(3, FEET));
    }	
    TEST(should be able to check equation of 1 MILE and 3 * 1760 feet)
    {
        ASSERT_EQ(Length(1, MILE), Length(3 * 1760, FEET));
    }

    TEST(should be able to check equation of 1 MILE and 1 MILE = 2 MILE)
    {
        ASSERT_EQ(Length(2, MILE),(Length(1, MILE)+Length(1, MILE)) );
    }	
    
    TEST(should be able to check equation of 1 MILE and 1760 yards = 2 MILE)
    {
        ASSERT_EQ(Length(2, MILE),(Length(1, MILE)+Length(1760, YARD)) );
    }	
    
    TEST(should be able to check equation of 1 yard and 3 feet = 2 yard)
    {
        ASSERT_EQ(Length(2, YARD),(Length(1, YARD)+Length(3 , FEET)));
    }	

    TEST(should be able to check equation of 3 feet and 1 yard = 2 yard)
    {
        ASSERT_EQ(Length(2, YARD),(Length(3 , FEET)+Length(1, YARD)) );
    }  

    TEST(Length  and Volume  can not be compareed)
    {        
        ASSERT_THROWS((Volume(1, OZ)==Length(1, YARD)), std::invalid_argument);
    } 

    TEST(Length  and Volume  can not be compareed)
    {
        ASSERT_THROWS((Volume(1, TSP)!=Length(1, FEET)), std::invalid_argument);
    } 

    TEST(Length  and Volume  can not be added)
    {
        ASSERT_THROWS((Volume(1, TBSP)+Length(1, MILE)), std::invalid_argument);
    } 
   
    TEST("5800 YARD format to string is: 1 MILE 173 YARD 1 FEET")
    {
        Volume  volume(5800, FEET);
        ASSERT_EQ(std::string("1 MILE 173 YARD 1 FEET"), volume.printInUnitFormat());
    }

    TEST("3000 FEET format to string is: 1 MILE 1240 YARD")
    {
        Volume  volume(3000, YARD);
        ASSERT_EQ(std::string("1 MILE 1240 YARD"), volume.printInUnitFormat());
    }

    TEST("0 MILE format to string is: 0 YARD")
    {
        Volume  volume(0, MILE);
        ASSERT_EQ(std::string("0 FEET"), volume.printInUnitFormat());
    }

    TEST("180 YARD format to min unit string is: 540 FEET")
    {
        Volume  volume(180, YARD);
        ASSERT_EQ(std::string("540 FEET"), volume.printInMinUnitFormat());
    }
    
    TEST("3000 YARD format to min unit string is: 9000 FEET")
    {
        Volume  volume(3000, YARD);
        ASSERT_EQ(std::string("9000 FEET"), volume.printInMinUnitFormat());
    }
    
    TEST("0 YARD format to min unit string is: 0 FEET")
    {
        Volume  volume(0, YARD);
        ASSERT_EQ(std::string("0 FEET"), volume.printInMinUnitFormat());
    }
    

};

